﻿using System.Data.SqlClient;

namespace ConsoleApp;

public class DemoConn
{
    public static void ConnectionState()
    {
        for (int i = 0; i < 1000; i++)
        {
            var j = i + 1;
            try
            {
                var connectStr = "server=10.10.30.11;uid=sa;pwd=sa@123;database=shikongdb_TianLaLa;Pooling=true;Max Pool Size=512;";
                var conn = new SqlConnection(connectStr);
                Console.WriteLine($"第{j}连接尝试打开");
                conn.Open();
                Console.WriteLine($"第{j}连接已打开");
            }
            catch (Exception e)
            {
                Console.WriteLine($"第{j}个异常：{e.Message}");
            }
        }
    }
}